#ifndef _ITEMMANAGER_H_
#define _ITEMMANAGER_H_


#include "ItemData.h"

#include "GamePlayer.h"

typedef fvoid	(*CommandFun1)( ItemData* , GamePlayer* , fint32 , fint32 );


typedef map< string , CommandFun1 > MapCommand;
typedef map< string , CommandFun1 >::iterator MapCommandIter;


class ItemManager : public baseSingle< ItemManager >
{
public:

	fint32 ItemCount[ SAIT_COUNT ];

	ItemManager();
	~ItemManager();

	fvoid			Load( const fbyte* path );

	ItemData*		GetItemData( fint32 id );

	CommandFun1		GetFun( const fbyte* name );


protected:


	static fvoid	CommandItemUseImprecate( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemConstitution( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemContract( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemMapEffect( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemMetamo( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemPetFollow( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemRandEnemyEquipOne( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemRefresh( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemTimeTicket( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemUseCaptureUp( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemUseDeathCounter( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemUseEncounter( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemUseFieldChange( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemUseFusionEditBase( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemUseLearnRideCode( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemUseMagic( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemUseMaxRedSocks( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemUseMaxRedSocksNew( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemUseMic( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemUseMRecovery( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemUseNoEnemy( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemUseOtherEditBase( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemUseRenameItem( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemUseRessurect( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemUseSkillCanned( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemUseSkup( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemUseWarp( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemUseWarpForNum( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemWaterWordStatus( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemUseRecovery( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemUseStatusRecovery( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemUseStatusChange( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemAddExp( ItemData* data , GamePlayer* c , fint32 p , fint32 t );


	static fvoid	CommandItemEquipNoEnemy( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemRemNoEnemy( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemMagicEquipWear( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemMagicEquitReWear( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemMagicResist( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemMagicReResist( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemRandEnemyEquip( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemReRandEnemyEquip( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemSuitEquip( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemReSuitEquip( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemWearEquip( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemReWearEquip( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemDropDice( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemPickupDice( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemPutOrnaments( ItemData* data , GamePlayer* c , fint32 p , fint32 t );
	static fvoid	CommandItemDieRelife( ItemData* data , GamePlayer* c , fint32 p , fint32 t );



private:

	static MapCommand		mCommands;

	static ItemDataMap		mItemDataMap;


};



extern ItemManager* gItemManager;


#endif


